<?php include("common/conn.php");  

if($_SESSION['shopid']!="") {
    echo "<script>window.location.href='index.php';</script>";
}

if($_POST) {
    $rert = mysql_query("select shopid from shop where shop_daima='".$_POST["tel"]."' and password='".$_POST["password"]."'"); 
    $sdg = mysql_fetch_array($rert);
    
    if($sdg == null) {
        $rert = mysql_query("select * from sub_shop where sub_name='".$_POST["tel"]."' and password='".$_POST["password"]."'"); 
        $sdg = mysql_fetch_array($rert);
    }

    
    if($sdg == true) {
        $_SESSION["shopid"] = $sdg['shopid'];
        if($sdg['type'] == 1) {
            $_SESSION['type'] = $sdg['type'];
        } else {
            $_SESSION['type'] = 0;
        }
        
        echo "<script>window.location.href='index.php';</script>";
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>RealAdmin后台管理系统模板 登录页面 - 源码之家</title>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script src="js/jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
    $("#loginform").validate();
});
</script>
<style type="text/css">
.error {
    padding: 7px;
    margin: 3px;
    background-color: #FCC;
    border: 1px solid #F00;
    font-family: arial;
    font-size: 10px;
    font-style: normal;
    font-weight: normal;
    font-variant: normal;
    color: #000;
    float: left;
    width: 98%;
    -moz-border-radius:5px;
    -webkit-border-radius: 5px;
}
</style>
<link href="css/styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div id="admin_wrapper">
                <form action="" id="loginform" method="post">
                        <!--START LOGO  --> 
                        <div id="logo">
                            <h1>
                                O2O后台管理
                                    <span>系统</span>
                            </h1>
                        </div>
                        <!-- END LOGO -->

                        <p>请登录!.</p>
                      
                        <!-- TEXTBOXES -->
                        <label>商家账号</label><br />
                        <input name="tel" type="text" class="text large required" id="username" /><br />
                        <div class="clearfix">&nbsp;</div>
                        <label>密码</label><br />
                        <input name="password" type="password" class="text large required" id="password" /><br />
                        <div class="clearfix">&nbsp;</div>
                    
                        <p>
                            <input name="btnLogin" type="submit" class="submit" id="btnLogin" value="登录" />
                            <input type="checkbox" class="checkbox" id="cbdemo2" />
                            <label for="cbdemo2">记住密码</label>
                        </p>
                </form>
    </div>
<!-- end admin wrapper -->
</body>
</html>
